<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml" 
	  xmlns:h="http://java.sun.com/jsf/html" 
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:p="http://primefaces.org/ui"
	  xmlns:ui="http://java.sun.com/jsf/facelets">


<h:head>

</h:head> 

<h:body>
<ui:composition template="/template.xhtml">

	<ui:define name="conteudo">
		<h1><p:outputLabel value="#{msg.evento}"/></h1>
		<h:form enctype="multipart/form-data" styleClass="formAllForm">
			<h:panelGrid columns="2" styleClass="painelEventoForm">
					
				<h:outputLabel value="#{msg.titulo} "/>
				<h:panelGroup>
					<p:inputText id="titulo" label="#{msg.titulo}" value="#{eventoManagedBean.evento.titulo}" required="true">
						<f:validateLength maximum="60"/>
					</p:inputText>
					<h:message for="titulo" showDetail="false" showSummary="true"/>
				</h:panelGroup>
							
				<h:outputLabel value="#{msg.conteudo} "/>
				<h:panelGroup>
					<p:inputTextarea style="width:500px;" id="conteudo" label="#{msg.conteudo}" value="#{eventoManagedBean.evento.conteudo}" required="true">
						<f:validateLength maximum="1500"/>
					</p:inputTextarea>
					<h:message for="conteudo" showDetail="false" showSummary="true"/>
				</h:panelGroup>
				
				<h:outputLabel value="#{msg.dataInicio} "/>
				<h:panelGroup>
					<p:calendar id="dataInicio" label="#{msg.dataInicio}" value="#{eventoManagedBean.evento.dataInicio}" 
								required="true" validator="#{formValidator.validateDataInicio}" />
					<h:message for="dataInicio" showDetail="false" showSummary="true"/>
				</h:panelGroup>
				
				<h:outputLabel value="#{msg.dataTermino} "/>
				<h:panelGroup>
					<p:calendar id="dataFim" label="#{msg.dataTermino}" value="#{eventoManagedBean.evento.dataFim}" 
								required="true" validator="#{formValidator.validateDataFim}" />
					<h:message for="dataFim" showDetail="false" showSummary="true"/>
				</h:panelGroup>
				
				<h:outputLabel value="Foto: "/>
				<h:panelGroup>
					<p:fileUpload id="arquivo" value="#{eventoManagedBean.arquivo}" mode="simple"  
								  auto="true" validator="#{formValidator.validateArquivo}" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
								  multiple="false" required="false" /> 
					<h:message for="arquivo" showDetail="false" showSummary="true" />		  
				</h:panelGroup>
						
				<h:commandButton value="#{msg.cadastrar}" action="#{eventoManagedBean.insere}" actionListener="#{eventoManagedBean.upload}"/>
				
			
			</h:panelGrid>	
		</h:form>
	</ui:define>
</ui:composition>
</h:body> 
     
</html>